package com.maya.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.maya.model.Question;
import com.maya.service.QuestionService;



@Controller
public class ViewAllQuestionsController {
	
	@Autowired
	private QuestionService questionService;
	
	
	@RequestMapping("/viewallquestions")
    public String viewallquestion(String searchContent,Model model) {
    	    	
        
        List<Question> questions = questionService.queryByTitle(searchContent);
        
        model.addAttribute("questions", questions);
        model.addAttribute("title", "所有问题");
        
        return "questions";
        
    }
    
    
}
